<?php
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$return['ischecklogin']=model('core/core')->checklogin('','',true);
	$_SESSION['memberid']=$this->model('member')->checkmember();
	$_SESSION['logout_forward']='jy_aihire/home/';
	$return['item']=pdo_get('jy_aihire_member',array('id'=>$_SESSION['memberid'],'uniacid'=>$_SESSION['uniacid']));
	pdo_update('jy_aihire_member',array('logintime'=>time()),array('id'=>$_SESSION['memberid'],'uniacid'=>$_SESSION['uniacid']));
	$return['item']['logo']=tomedia($return['item']['logo']);
	$return['isopenvoice']=$return['item']['isopenvoice'];
	$return['plugin_icon']=$return['item']['logo'];
	$this->session('plugin_icon',$return['item']['logo']);
	$member=model('core/member')->detail($_SESSION['uid'],array('credit1','credit2','credit3','credit4','credit5','credit6','mobile','avatar','nickname'));
	$return['item']=array_merge($member,$return['item']);
	$return['item']['logo']=$return['item']['logo']?$return['item']['logo']:$member['avatar'];
	$return['item']['nickname']=$return['item']['nickname']?$return['item']['nickname']:$member['nickname'];
	$return['data']['orderfee']=pdo_getsum('jy_aihire_gongfee',array('status'=>1,'memberid'=>$_SESSION['memberid'],'uniacid'=>$_SESSION['uniacid']),'fee');
	$return['data']['ordernum']=pdo_count('jy_aihire_gong',array('status'=>1,'memberid'=>$_SESSION['memberid'],'uniacid'=>$_SESSION['uniacid']));
	$return['data']['looknum']=pdo_count('jy_aihire_looklog',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	$infobtn = array(
			array('title'=>'个人资料','icon'=>'icon-wo1','color'=>'#cc99ff','action'=>'jy_aihire/myinfo/'),
			array('title'=>'银行卡','icon'=>'icon-huiyuanqia','color'=>'#cc99ff','action'=>'jy_aihire/mybank/'),
			array('title'=>'保单','icon'=>'icon-baozhengjin','color'=>'#cc99ff','action'=>'jy_aihire/mybaodan/'),
			array('title'=>'电子合同','icon'=>'icon-tianmaoanshidaohuo','color'=>'#cc99ff','action'=>'jy_aihire/myhetong/'),
			array('title'=>'钱包','icon'=>'icon-wodeqianbao1','color'=>'#cc99ff','action'=>'core/member.feecard/'),
			array('title'=>'微工卡','icon'=>'icon-_wodeqianbao','color'=>'#cc99ff','action'=>'jy_aihire/mycard/'),
			array('title'=>'支付宝','icon'=>'icon-zhifubaoa','color'=>'#cc99ff','action'=>'jy_aihire/myalipay/'),
			array('title'=>'资质','icon'=>'icon-renzheng','color'=>'#cc99ff','action'=>'jy_aihire/myimages/'),
	);
	$return['pluginset']['infobtn'] = $return['pluginset']['infobtn']?: $infobtn;
	$otherbtn = array(
			array('title'=>'信息','icon'=>'icon-liaotian','color'=>'#cc99ff','action'=>'jy_aihire/mymsg/'),
			array('title'=>'评价','icon'=>'icon-pingjia','color'=>'#cc99ff','action'=>'jy_aihire/mypingjia/'),
			array('title'=>'协议','icon'=>'icon-fenxiaodianzhao','color'=>'#cc99ff','action'=>'jy_aihire/myxieyi/'),
			array('title'=>'任务','icon'=>'icon-fenlei2','color'=>'#cc99ff','action'=>'jy_aihire/gong/'),
			array('title'=>'记录','icon'=>'icon-dingdan','color'=>'#cc99ff','action'=>'jy_aihire/job_log/'),
	);
	$return['pluginset']['otherbtn'] = $return['pluginset']['otherbtn']?: $otherbtn;
	set_html('title','会员中心');
	exi($return);
}
if($_RQ['op']=='getdata'){
	$params=array('uniacid'=>$_SESSION['uniacid'],'merchid'=>$merchid);
	//创建时间
	if($_RQ['tstart'] && $_RQ['tend']){
		$params['createtime between']=array($_RQ['tstart'],$_RQ['tend']);
	}else{
		$daytype=intval($_RQ['daytype']);
		if($daytype==0){
			$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
			$params['createtime >']=$daytime;
		}elseif($daytype==1){
			$yesdaytime = mktime(0,0,0,date('m'),date('d')-1,date('Y'));
			$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
			$params['createtime between']=array($yesdaytime,$daytime);
		}elseif($daytype==2){
			$day7time = mktime(0,0,0,date('m'),date('d')-7,date('Y'));
			$params['createtime >']=$day7time;
		}elseif($daytype==3){
			
		}
	}
	//print_r($params);exit;
	$params['ispay']=1;
	$return['params']=$params;
	$return['data']=$data;
	exi($return);
}
//获取小程序订阅消息ID
if($_RQ['op']=='get_tmpids'){
	$tmplIds=array();
	$tmpid=cfc('wxapp_api')->get_tpl_template_id('1538',[7,1,2,3],'pay2seller','订单支付成功通知卖方','jy_aihire');
	if($tmpid){
		$tmplIds[]=$tmpid;
	}
	$res['list']=$tmplIds;
	exi($res);
}